'''
1.登录系统后点击“系统设置”返回--->点击“高级设置”返回-->点击“安全设置”返回
'''
from selenium.webdriver.common.by import By

from Foo.capability_json import getDriver
from Foo.advanced_setup import Advanced
from Foo.login import Login
from Foo.modeSetting import ModeSetting
from util.baseView import BaseView
import time

class PageSwitch(Login,Advanced,BaseView):
    def __init__(self,driver):
        BaseView.__init__(self,driver)
        # 继承Advanced 的私有属性，如果未继承会报错，可以注释掉此行查看错误信息
        Advanced.__init__(self,driver)
        self.back = (By.ID, 'com.sykean.biometrics:id/btn_back')
        self.home = (By.ID, 'com.sykean.biometrics:id/btn_home')
        self.menu_settings = (By.ID, 'com.sykean.biometrics:id/menu_settings')
        self.menu_output_params = (By.ID,'com.sykean.biometrics:id/menu_output_params')
        self.menu_advance = (By.ID, 'com.sykean.biometrics:id/menu_advance')
        self.menu_security = (By.ID, 'com.sykean.biometrics:id/menu_security')
        self.menu_about = (By.ID,'com.sykean.biometrics:id/menu_about')
        self.menu_user = (By.ID,'com.sykean.biometrics:id/menu_user')
        self.menu_mode = (By.ID,'com.sykean.biometrics:id/menu_mode')
    # 人员管理
    def menuUser(self):
        self.click_element(*self.menu_user)
        time.sleep(2)

    def menuSettings(self):
        self.click_element(*self.menu_settings)
        time.sleep(2)
        self.click_element(*self.back)

    def menuOutputParams(self):
        self.click_element(*self.menu_output_params)
        time.sleep(2)
        self.click_element(*self.back)


    def menuAdvance(self):
        self.click_element(*self.menu_advance)
        time.sleep(2)
        self.irisPreview()
        self.click_element(*self.back)

    def menuSecurity(self):
        self.click_element(*self.menu_security)
        time.sleep(2)
        self.click_element(*self.back)

    def menuAbout(self):
        self.click_element(*self.menu_about)
        time.sleep(2)
        self.click_element(*self.back)

    # LS900专属模块
    def menuMode(self):
        self.click_element(*self.menu_mode)
        time.sleep(2)
        self.click_element(*self.back)

if __name__ == '__main__':
    driver = getDriver()
    Login(driver).login()
    while True:
        PageSwitch(driver).menuSettings()
        PageSwitch(driver).menuOutputParams()
        PageSwitch(driver).menuSecurity()
        PageSwitch(driver).menuAbout()
        PageSwitch(driver).menuMode()
        # ModeSetting(driver).test_runAll()

